package com.kstech.mp3604.data.dao

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Update
import com.kstech.mp3604.bean.ControlInitData

/**
 * author: blankii
 * created on: 2025/3/18 14:29
 * description:
 */
@Dao
interface InitConfigDao {
    //查询数据总条数
    @Query("SELECT count(*) FROM initConfig")
    fun queryInitConfigCount(): Int

    //根据姓名参数查询
    @Query("SELECT * FROM initConfig WHERE (address=:address AND sIndex=:index)")
    fun queryControlInitData(address: String, index: Int): MutableList<ControlInitData>

    // 添加批量数据
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun addBatchControlInitData(list: MutableList<ControlInitData>)

    // 更新某一个数据
    @Update
    fun updateControlInitData(controlInitData: ControlInitData)


}